<?php
/**
 * CreateUser:zlh
 * CreateTime:2022/1/15
 * Remark:该类为员工新增参数验证
 */
namespace App\Http\Requests\Staff;

use App\Http\Requests\BaseRequests;

class AddStaffPost extends BaseRequests
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'staff_name' => "required",
            'staff_login_account' => "required|min:6|max:11",
            'staff_login_password' => "required|min:6|max:21",
            'departments' =>"required",
            'company_id' =>"required",
            'staff_email' =>"email:rfc,dns"
        ];
    }

    public function messages()
    {
        return [
            'staff_name.required' => "员工姓名不能为空",
            'staff_login_account.required' => "员工登录账号不能为空",
            'staff_login_account.min' => "员工登录账号不能少于6位",
            'staff_login_account.max' => "员工登录账号不能大于11位",
            'staff_login_password.required' => "员工登录密码不能为空",
            'staff_login_password.min' => "员工登录密码不能少于6位",
            'staff_login_password.max' => "员工登录密码不能大于21位",
            'departments.required' => "员工部门不能为空",
            'company_id.required' => "公司不能为空",
            'staff_email.email' => "邮箱格式错误",
        ];
    }


}
